﻿using Pulog.Models;
using System.Linq;
using System.Collections.Generic;

namespace Pulog.Models
{
    public partial class SettingRepository : ISettingRepository
    {
        private PulogDataContext dc = new PulogDataContext();
       
        public List<Setting> GetSettings()
        {
            return dc.Settings.ToList();
        }

        public void SaveSettings(List<Setting> settings)
        {
            dc.Settings.InsertAllOnSubmit(settings);
        }

        public string GetSettingByKey(string key)
        {
            return dc.Settings.Single(s => s.Key == key).Value;
        }

        public void Save()
        {
            dc.SubmitChanges();
        }

    }
}